package chain.example.delivery;

import chain.example.delivery.chain.DeliveryChain;
import chain.example.delivery.chain.DeliveryChainDefaultImpl;

public class Client {

    public static void main(String[] args) {
        String orderId = "20180512000000001";

        DeliveryChain chain = new DeliveryChainDefaultImpl();
        /**
         * 和数据库中不匹配的状态
         */
        System.out.println(chain.doChain(100).getMessage(orderId));
        /**
         * 未支付的配送信息
         */
        System.out.println(chain.doChain(DeliveryState.NOT_PAY.getState()).getMessage(orderId));
        /**
         * 已支付的配送信息
         */
        System.out.println(chain.doChain(DeliveryState.PAYED.getState()).getMessage(orderId));
        /**
         * 商户发货的配送信息
         */
        System.out.println(chain.doChain(DeliveryState.SHOP.getState()).getMessage(orderId));
        /**
         * 第三方回调的配送信息
         */
        System.out.println(chain.doChain(DeliveryState.REAL_DELIVERY.getState()).getMessage(orderId));


    }


}
